package com.cyzy.controller;

import com.cyzy.dao.ClassCourseDao;
import com.cyzy.dto.Result;
import com.cyzy.pojo.CourseCla;
import com.cyzy.pojo.CourseStu;
import com.cyzy.service.CourseClaService;
import com.cyzy.service.MyClassService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/myclass")
public class MyClassController {

    @Autowired
    private MyClassService myClassService;
    @Autowired
    private CourseClaService courseClaService;

//    通过UseId查找班级Id // 老师 点名
    @GetMapping("/selectClass")
    public Result selectClass(CourseCla courseCla){
        List<CourseCla> claList = courseClaService.selectClass(courseCla);
        return Result.ok().data("claList",claList);
    }


//    通过classId查找学生
    @GetMapping("/selectStu")
    public Result selectStu(CourseStu courseStu){

        return Result.ok().data("stuList", myClassService.selectStu(courseStu));
    }

//    通过campusId查询班级
    @GetMapping("/selectAllClass")
    public Result selectAllClass(CourseCla courseCla){
        List<CourseCla> claList = courseClaService.selectAllClass(courseCla);
        return Result.ok().data("claList",claList);
}

//   调课：
    @GetMapping("/reschedule")
    public Result reschedule(ClassCourseDao classCourseDao){
        List<ClassCourseDao> rescheduleClassList = courseClaService.selectCourseId(classCourseDao);
        return Result.ok().data("rescheduleClassList",rescheduleClassList);
    }




}
